home *** CD-ROM | disk | FTP | other *** search
- Path: news.halcyon.com!usenet
- From: normanb@halcyon.com (Norm Bryar)
- Newsgroups: comp.lang.c++
- Subject: Re: A question of privacy
- Date: Sat, 20 Apr 1996 15:37:35 GMT
- Organization: Northwest Nexus Inc.
- Message-ID: <4lb0ag$5m6@news.halcyon.com>
- References: <3177F514.544E@cstar.ac.com>
- NNTP-Posting-Host: blv-pm2-ip16.halcyon.com
- X-Newsreader: Forte Free Agent 1.0.82
-
- Asgeir Olafsson <olafsson@cstar.ac.com> wrote:
-
- >Should the following work according to the ANSI C++
- >standard draft?
-
- >// Compiles fine under VC++ 4.0
- >class A {
- >private:
- > A() {}
- >};
-
- >class B {
- >public:
- > A &f() { return A();} // No complaints about privacy
- >};
-
- >void g()
- >{
- > B b;
- > A a = b.f();
- >}
-
-
- >I suspect what is happening, is that a temporary object
- >is being created, so if this is legal the object could be
- >deleted as soon as "a" goes out of scope?
-
- >Regards,
- >'Asgeir.
-
- It looks like a VC bug to me. --Norm
-
-